/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-12-03     hehung       the first version
 */

#ifndef APP_HW_I2C_H_
#define APP_HW_I2C_H_

#define NON_REENTRANT

typedef enum
{
    C_READY = 0,
    C_START_BIT,
    C_STOP_BIT
} CommCtrl_t;

typedef enum
{
    MASTER_OK = 0,
    MASTER_BUSY,
    MASTER_MODE,
    MASTER_TXMODE,
    MASTER_RXMODE,
    MASTER_SENDING,
    MASTER_SENDED,
    MASTER_RECVD,
    MASTER_BYTEF,
    MASTER_BUSERR,
    MASTER_UNKNOW,
    SLAVE_OK = 20,
    SLAVE_BUSY,
    SLAVE_MODE,
    SLAVE_BUSERR,
    SLAVE_UNKNOW
}ErrCode_t;


extern void i2c_config(void);
extern int i2c_master_send(uint8_t slave_addr, uint8_t* data, uint8_t len);
extern int i2c_master_recv(uint8_t slave_addr, uint8_t* data, uint8_t len);

#endif /* APP_OLED_H_ */
